#ifndef _OOGLRENDER_H_
#define _OOGLRENDER_H_

#include "ooengine.h"
#include "gl/glew.h"

//------------------------------------------------------------------------
class ooDisplayWindow;
class ooImage;
class oo2DPrimitivesGroup;
class ooTexture;

//------------------------------------------------------------------------
class ooGLRender
{
public:
	ooGLRender();
	virtual ~ooGLRender();

	void				focusWindow(ooDisplayWindow* window);
	void				setupRender();

	void				tick(float elapsed);
	void				bindTexture(Ptr<ooTexture> texture);

	void				beginFrame();
	void				endFrame();
	void				present();

	void				begin2D();
	void				render2DPrimitivesGroup(const oo2DPrimitivesGroup* group);
	void				end2D();

	void				drawImage(const ooImage* image);

protected:


protected:
	struct oo2DQuad
	{
		float	m_tex[2];
		uint32	m_color;
		float	m_vertex[3];
	};

	bool				m_windowed;
	bool				m_setup;
	ooDisplayWindow*	m_focus;

	oo2DQuad			m_2DQuad[OOGL_2DQUAD_MAXLENGTH];

	bool				m_begined;
	GLint				m_vp[4];
};

#endif